package com.woniuxy.user.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.Arrays;

@Configuration
public class MyFilterConfig {
    @Resource
    private LoginFilter loginFilter;
    @Bean
    public FilterRegistrationBean<LoginFilter> registrationBean(){
        FilterRegistrationBean<LoginFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(loginFilter);
        bean.setUrlPatterns(Arrays.asList("/oauth/token"));
        bean.setOrder(10000);
        return bean;
    }
}